package personal.xjl._23java1studentdemo.mapper;

import org.apache.ibatis.annotations.*;
import personal.xjl._23java1studentdemo.model.Student;
import personal.xjl._23java1studentdemo.model.Teacher;
import java.util.List;

@Mapper
public interface TeacherMapper {
    @Select("select * from teacher")
    List<Teacher> selectAll();
    @Delete("delete from teacher where id=#{id};")
    int delete(int id);
    @Insert("insert into teacher(name, password, sex, birthday, course_id, professional) values (#{name}, #{password}, #{sex}, #{birthday}, #{course_id}, #{professional})")
    int insert(Teacher teacher);
    @Select("select * from teacher where id = #{id}")
    Teacher selectById(int id);
    @Update("update teacher set name = #{name}, password = #{password}, sex = #{sex}, birthday = #{birthday}, course_id = #{course_id}, professional = #{professional} where id = #{id}")
    int update(Teacher teacher);
    @Select("select * from teacher limit #{fromIndex},#{pageSize}")
    List<Teacher> selectByPage(int fromIndex, int pageSize);
}
